<template>
    <el-form :inline="true" :model="formInline">
        <el-form-item label="设备名称">
            <el-input v-model="formInline.user" placeholder="请输入设备名称查询" clearable />
        </el-form-item>
        <el-form-item label="通讯状态">
            <el-select v-model="formInline.region" placeholder="请选择通讯状态" clearable>
                <el-option label="正常" value="0" />
                <el-option label="异常" value="1" />
            </el-select>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="search">搜索</el-button>
            <el-button type="primary" size="default" @click="reset">重置</el-button>
        </el-form-item>
    </el-form>
    <div class="alert">
        <div class="alert-Content">
            <div class="alert-left">
                <el-icon :size="20" color="#409EFC">
                    <WarningFilled />
                </el-icon>
                异常设备:<span class="red-text">0</span>
            </div>
            <div class="alert-right">
                <el-icon :size="20" color="#409EFC">
                    <Refresh />
                </el-icon>
                刷新
            </div>
        </div>
    </div>
    <div class="mt15">
        <el-table :data="generatorData" border>
            <el-table-column prop="generatorName" label="发电机名称"></el-table-column>
            <el-table-column prop="timestamp" label="更新时间"></el-table-column>
            <el-table-column prop="generatorStatus" label="状态"></el-table-column>
            <el-table-column prop="generatorPower" label="功率（W）"></el-table-column>
            <el-table-column prop="generatorVoltage" label="电压（V）"></el-table-column>
            <el-table-column prop="generatorCurrent" label="电流（A）"></el-table-column>
            <el-table-column prop="generatorTemperature" label="温度（℃）"></el-table-column>
            <el-table-column prop="frequency" label="频率（Hz）"></el-table-column>

        </el-table>

    </div>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue'

const formInline = reactive({
    user: '',
    region: '',
})
const search = () => {
    console.log('submit!')
}
//重置按钮
const reset = () => {
}
interface GeneratorData {
    generatorName: string;
    timestamp: string;
    generatorStatus: string;
    generatorPower: number;
    generatorVoltage: number;
    generatorCurrent: number;
    generatorTemperature: number;
    frequency: number
}
const generatorData = ref<GeneratorData[]>([
    {
        generatorName: '发电机1',
        timestamp: '2022-01-01 10:00:00',
        generatorStatus: '运行中',
        generatorPower: 100,
        generatorVoltage: 220,
        generatorCurrent: 10,
        generatorTemperature: 50,
        frequency: 20
    },
    // 可以添加更多的发电机数据
])

</script>

<style scoped lang="scss"></style>